package com.simulation.web.mapper;

import com.simulation.web.domain.TechTaskSubmissions;
import com.simulation.web.dto.TaskSubmissionsDTO;
import com.simulation.web.vo.TechTaskSubmissionsVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @Author 唐雄杰
 * @Date 2024-08-26 19:15
 **/
@Mapper
public interface TaskSubmissionsMapper {
    /**
     * 批量生成任务提交数据
     * @param taskSubmissions
     * @return
     */
    int batchInsert(@Param("list") List<TechTaskSubmissions> taskSubmissions);

    /**
     * 根据任务id分页查询任务提交列表
     * @param taskSubmissionsDTO
     * @return
     */
    List<TechTaskSubmissionsVO> getPageByTaskId(@Param("taskSubmissionsDTO") TaskSubmissionsDTO taskSubmissionsDTO);

    /**
     * 根据任务提交id查询提交详情
     * @param id
     * @return
     */
    TechTaskSubmissionsVO getById(@Param("id") Long id);

    /**
     * 根据任务提交id删除数据
     * @param idList
     * @return
     */
    int deleteById(@Param("idList") List<Long> idList);

    /**
     * 用户
     * @param userId
     * @return
     */
    int deleteByUserId(@Param("userId") Long userId,@Param("taskIdList") List<Long> taskIdList);

    int deleteByTaskIds(@Param("taskIdList") List<Long> taskIdList);


    int deleteByTaskId(@Param("taskId") Long taskId);

    List<TechTaskSubmissionsVO> getByUserIdAndTaskId(@Param("taskIdList") List<Long> taskIdList, @Param("userIdList") List<Long> userIdList);
    /**
     * 更新提交详情（忽略null值）
     * @param techTaskSubmissions
     * @return
     */
    int updateIgnoreNull(@Param("techTaskSubmissions") TechTaskSubmissions techTaskSubmissions);

    /**
     * 查找用户的任务列表
     * @param userId
     * @param statusList
     * @return
     */
    List<TechTaskSubmissionsVO> getPageByUserId(@Param("userId") Long userId, @Param("statusList") List<String> statusList);
}
